﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sponsorship.Ui.Wpf.Locator;
using Sponsorship.Ui.Wpf.Commanding;
using System.Windows.Input;
using Sponsorship.Ui.Wpf.Messaging;

namespace Sponsorship.Ui.Wpf.ViewModel
{
    [LocatorAttribute("MainMenuViewModel")]
    public class MainMenuViewModel : ViewModelBase
    {
        private RelayCommand openSponsorshipList;
        private RelayCommand addSponsor;
        private RelayCommand openPersonList;
        private RelayCommand addPerson;
        private RelayCommand openPresentList;
        private RelayCommand addPresent;
        private RelayCommand openPresentTemplateList;
        private RelayCommand addPresentTemplate;

        public ICommand OpenSponsorshipListCommand
        {
            get
            {
                if (openSponsorshipList == null)
                    openSponsorshipList = new RelayCommand(OpenSponsorshipList);
                return openSponsorshipList;
            }
        }

        private void OpenSponsorshipList(object param)
        {
            Messenger.Instance.Send(this, "sponsorlist");
        }

        public ICommand AddSponsorCommand
        {
            get
            {
                if (addSponsor == null)
                    addSponsor = new RelayCommand(AddSponsor);
                return addSponsor;
            }
        }

        private void AddSponsor(object param)
        {
            Messenger.Instance.Send(this, "addsponsor");
        }
   

        public ICommand OpenPersonListCommand
        {
            get
            {
                if (openPersonList == null)
                    openPersonList = new RelayCommand(OpenPersonList);
                return openPersonList;
            }
        }

        private void OpenPersonList(object param)
        {
            Messenger.Instance.Send(this, "personlist");
        }

        public ICommand AddPersonCommand
        {
            get
            {
                if (addPerson == null)
                    addPerson = new RelayCommand(AddPerson);
                return addPerson;
            }
        }

        private void AddPerson(object param)
        {
            Messenger.Instance.Send(this, "addperson");
        }

        
        public ICommand OpenPresentListCommand
        {
            get
            {
                if (openPresentList == null)
                    openPresentList = new RelayCommand(OpenPresentList);
                return openPresentList;
            }
        }

        private void OpenPresentList(object param)
        {
            Messenger.Instance.Send(this, "presentlist");
        }

        public ICommand AddPresentCommand
        {
            get
            {
                if (addPresent == null)
                    addPresent = new RelayCommand(AddPresent);
                return addPresent;
            }
        }

        private void AddPresent(object param)
        {
            Messenger.Instance.Send(this, "addpresent");
        }

        public ICommand OpenPresentTemplateListCommand
        {
            get
            {
                if (openPresentTemplateList == null)
                    openPresentTemplateList = new RelayCommand(OpenPresentTemplateList);
                return openPresentTemplateList;
            }
        }

        private void OpenPresentTemplateList(object param)
        {
            Messenger.Instance.Send(this, "presenttemplatelist");
        }

        public ICommand AddPresentTemplateCommand
        {
            get
            {
                if (addPresentTemplate == null)
                    addPresentTemplate = new RelayCommand(AddPresentTemplate);
                return addPresentTemplate;
            }
        }

        private void AddPresentTemplate(object param)
        {
            Messenger.Instance.Send(this, "addpresenttemplate");
        }
    }


}
